﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using AnguaRPGEngine.Library.Systems;

namespace AnguaRPGEngine.Library.Dice
{
    public class D6 : IDie
    {
        #region ctor
        public D6()
        {
        }
       
        #endregion
        #region IDie Members
        #region Image
        public System.Drawing.Bitmap Image
        {
            get
            {
                Font digitFont = new Font(FontFamily.GenericSansSerif, 24f);
                Bitmap i = ImageLibrary.Instance.GetImageFromLibrary(string.Format("Dice.{0}.D{1}", DieRoller.Instance.DiceCollection.CurrentSet.PathName, Sides, _Value));
                using (Graphics g = Graphics.FromImage(i))
                {
                    g.DrawString(Value.ToString(), digitFont, new SolidBrush(DieRoller.Instance.DiceCollection.CurrentSet.PipColorAsColor()), new PointF(10, 6));

                    if(Value == 6)
                    {
                        g.DrawLine(new Pen(new SolidBrush(DieRoller.Instance.DiceCollection.CurrentSet.PipColorAsColor()), 1f), new Point(18,40), new Point(28,40));
                    }
                }
                return i;
            }
        }
        #endregion
        #region Sides
        public int Sides
        {
            get
            {
                return 6;
            }
        }
        #endregion
        #region Value
        private int _Value = 1;
        public int Value
        {
            get
            {
                return _Value;
            }
        }
        #endregion
        #region Roll
        public void Roll()
        {
            _Value = Randomizer.Instance.NextInt(1, Sides);
        }
        #endregion
        #endregion
    }
}
